
//
//  ExpertDetailTextCell.m
//  DaJiang
//
//  Created by sally on 16/10/9.
//  Copyright © 2016年 jiniu. All rights reserved.
//

#import "ExpertDetailTextCell.h"

@interface ExpertDetailTextCell ()

@property (weak, nonatomic) IBOutlet UILabel *contentLabel;

@end

static CGFloat height = 40;

@implementation ExpertDetailTextCell

- (void)awakeFromNib {
  [self initControl];
}

- (void)initControl {
}

+ (CGFloat)cellHeight {
  return height;
}

- (void)setCellData:(NSString *)cellData{
  self.contentLabel.text = cellData;
  self.contentLabel.preferredMaxLayoutWidth = ScreenWidth - GNormalMargin * 2; //配合计算包裹高度
  self.contentLabel.numberOfLines = self.isLimitHeight? 7 : 0;

  //FIXME: 为什么，直接计算的高度用不上去
  //  CGSize maxSize = CGSizeMake(ScreenWidth - GNormalMargin * 2, MAXFLOAT);
  //  NSDictionary *attrs = @{NSFontAttributeName : GCustomNormalFont};
  //  CGFloat height = [[CommonMethod sharedCommonMethod] heightForString:cellData maxSize:maxSize attrs:attrs];
  //  height = height + GNormalMargin * 2;

  height = [self.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height + 5;

  NSLog(@"ExpertDetailTextCell-height:%f", height);
}

@end
